<?php
$host='localhost';
$user_name='root';
$password='helloworld';
session_start();
$number=$_SESSION['num'];
$_SESSION['bool']=1;
$arr_offerstate=array('有'=>'有','无'=>'无','已签'=>'已签');
$arr_homestate=array('学校'=>'学校','原籍'=>'原籍');
$arr_homefuture=array('原籍'=>'原籍','人才'=>'人才','公司'=>'公司');
$arr_filefuture=array('原籍'=>'原籍','人才'=>'人才','公司'=>'公司');

$conn=mysql_connect($host,$user_name,$password);

if(!$conn)
{
    die('数据库连接失败：'.mysql_error());

}

mysql_select_db('101024');



$sql="select * from class where 学号='$number'";
$result=mysql_query($sql) OR die("<br/>ERROR:<b>".mysql_error()."</b><br/>SQL:".$sql);
$row=mysql_fetch_array($result,MYSQL_ASSOC);
mysql_close();
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>创建信息</title>
</head>
<body>
<b>提交用户信息</b>
<form name="form" method="post" action="PageInfo.php">
    <table width="25%" border="0" cellpadding="0" cellspacing="2" >
        <tr>
            <td width="40%" height="29">学号：</td>
            <td width="60%"><input name="number" type="text" id="homeland" size="20"  value="<?php echo $row['学号']?>"/></td>
        </tr>
        <tr>
            <td width="40%" height="29">姓名：</td>
            <td width="60%"><input name="name" type="text" id="homeland" size="20"  value="<?php echo $row['姓名']?>"/></td>
        </tr>

        <tr>
            <td width="40%" height="29">生源地：<br/></td>
            <td width="60%"><input name="homeland" type="text" id="homeland" size="20"  value="<?php echo $row['生源地']?>"/></td>
        </tr>


        <tr>
            <td width="40%" height="29">已签约单位：</td>
            <td width="60%"><input name="offer" type="text" id="offer" size="20" value="<?php echo $row['已签约单位']?>"/></td>
        </tr>
        <tr>
            <td width="40%" height="29">实习单位：</td>
            <td width="60%"><input name="company" type="text" id="company" size="20"  value="<?php echo $row['实习单位']?>"/></td>
        </tr>
        <tr>
            <td height="25">有无签约意向：</td>
            <td>
                <select name="offerstate">
                    <?php
                    foreach($arr_offerstate as $k=>$v)
                    {
                        $option=($row['意向']==$k)?'<option value="'.$k.'" selected>'.$v.'</option>':'<option value="'.$k.'">'.$v.'</option>';
                        echo $option.'\n';
                    }
                    ?>
                </select>
            </td>
        </tr>


        <tr>
            <td height="25">户口状态：</td>
            <td>
                <select name="homestate">
                    <?php
                    foreach($arr_homestate as $k=>$v)
                    {
                        $option=($row['户口状态']==$k)?'<option value="'.$k.'" selected>'.$v.'</option>':'<option value="'.$k.'">'.$v.'</option>';
                        echo $option.'\n';
                    }
                    ?>
                </select>
            </td>
        </tr>
        <tr>
            <td height="25">毕业后户口意向：</td>
            <td>
                <select name="homefuture">
                    <?php
                    foreach($arr_homefuture as $k=>$v)
                    {
                        $option=($row['户口意向']==$k)?'<option value="'.$k.'" selected>'.$v.'</option>':'<option value="'.$k.'">'.$v.'</option>';
                        echo $option.'\n';
                    }
                    ?>
                </select>
            </td>
        </tr>
        <tr>
            <td height="25">毕业后档案意向：</td>
            <td>
                <select name="filefuture">
                    <?php
                    foreach($arr_filefuture as $k=>$v)
                    {
                        $option=($row['档案意向']==$k)?'<option value="'.$k.'" selected>'.$v.'</option>':'<option value="'.$k.'">'.$v.'</option>';
                        echo $option.'\n';
                    }
                    ?>
                </select>
            </td>
        </tr>




        <tr>
            <td height="1">
                <input type="submit" name="Submit" value="修改信息" /></td>
            <td> </td>
        </tr>
    </table>
</form>
</body>
</html>